/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package gamedsl2.impl;

import gamedsl2.Gamedsl2Package;
import gamedsl2.TileEnvironment;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Tile Environment</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link gamedsl2.impl.TileEnvironmentImpl#getTileWidth <em>Tile Width</em>}</li>
 *   <li>{@link gamedsl2.impl.TileEnvironmentImpl#getTileHeight <em>Tile Height</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TileEnvironmentImpl extends AbstractEnvironmentImpl implements TileEnvironment {
	/**
	 * The default value of the '{@link #getTileWidth() <em>Tile Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTileWidth()
	 * @generated
	 * @ordered
	 */
	protected static final int TILE_WIDTH_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getTileWidth() <em>Tile Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTileWidth()
	 * @generated
	 * @ordered
	 */
	protected int tileWidth = TILE_WIDTH_EDEFAULT;

	/**
	 * The default value of the '{@link #getTileHeight() <em>Tile Height</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTileHeight()
	 * @generated
	 * @ordered
	 */
	protected static final int TILE_HEIGHT_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getTileHeight() <em>Tile Height</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTileHeight()
	 * @generated
	 * @ordered
	 */
	protected int tileHeight = TILE_HEIGHT_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TileEnvironmentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Gamedsl2Package.Literals.TILE_ENVIRONMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getTileWidth() {
		return tileWidth;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTileWidth(int newTileWidth) {
		int oldTileWidth = tileWidth;
		tileWidth = newTileWidth;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Gamedsl2Package.TILE_ENVIRONMENT__TILE_WIDTH, oldTileWidth, tileWidth));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getTileHeight() {
		return tileHeight;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTileHeight(int newTileHeight) {
		int oldTileHeight = tileHeight;
		tileHeight = newTileHeight;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Gamedsl2Package.TILE_ENVIRONMENT__TILE_HEIGHT, oldTileHeight, tileHeight));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Gamedsl2Package.TILE_ENVIRONMENT__TILE_WIDTH:
				return getTileWidth();
			case Gamedsl2Package.TILE_ENVIRONMENT__TILE_HEIGHT:
				return getTileHeight();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Gamedsl2Package.TILE_ENVIRONMENT__TILE_WIDTH:
				setTileWidth((Integer)newValue);
				return;
			case Gamedsl2Package.TILE_ENVIRONMENT__TILE_HEIGHT:
				setTileHeight((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Gamedsl2Package.TILE_ENVIRONMENT__TILE_WIDTH:
				setTileWidth(TILE_WIDTH_EDEFAULT);
				return;
			case Gamedsl2Package.TILE_ENVIRONMENT__TILE_HEIGHT:
				setTileHeight(TILE_HEIGHT_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Gamedsl2Package.TILE_ENVIRONMENT__TILE_WIDTH:
				return tileWidth != TILE_WIDTH_EDEFAULT;
			case Gamedsl2Package.TILE_ENVIRONMENT__TILE_HEIGHT:
				return tileHeight != TILE_HEIGHT_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (tileWidth: ");
		result.append(tileWidth);
		result.append(", tileHeight: ");
		result.append(tileHeight);
		result.append(')');
		return result.toString();
	}

} //TileEnvironmentImpl
